package org.example.topicExchange;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author 望轩
 * @createDate 2024/7/4 16:24
 */
@Component
public class NewsConsumer {

    @RabbitListener(queues = "politics.queue")
    public void receivePoliticsNews(String newsJson) {
        System.out.println("Received politics news: " + newsJson);
        // Process the news...
    }

    @RabbitListener(queues = "sports.queue")
    public void receiveSportsNews(String newsJson) {
        System.out.println("Received sports news: " + newsJson);
        // Process the news...
    }

    @RabbitListener(queues = "entertainment.queue")
    public void receiveEntertainmentNews(String newsJson) {
        System.out.println("Received entertainment news: " + newsJson);
        // Process the news...
    }
}
